<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="./template.xhtml">

    <ui:define name="title">
        DefaultCommand - <span class="subitem">Basic</span>
    </ui:define>

    <ui:define name="description">
        DefaultCommand controls which command to initiate form submit with when enter key is pressed. Example
        below demonstrates 3 types of buttons; non-ajax, ajax and standard.
    </ui:define>

    <ui:param name="documentationLink" value="/components/defaultcommand" />

    <ui:define name="implementation">

        <h:form id="form">
            <p:growl>
                <p:autoUpdate />
            </p:growl>

            <p:panelGrid columns="2" layout="flex" columnClasses="p-col-4, p-col-8" styleClass="ui-fluid">
                <h:outputLabel for="btnSelect" value="Default Button:" />
                <p:selectOneMenu id="btnSelect" value="#{defaultCommandView.btn}" onchange="$('#form').submit()">
                    <f:selectItems value="#{defaultCommandView.buttons}" />
                </p:selectOneMenu>

                <h:outputLabel for="name" value="Name:" style="font-weight:bold"/>
                <p:inputText id="name" value="#{defaultCommandView.text}" />
            </p:panelGrid>

            <br/>

            <p:commandButton value="Button1" id="btn1" action="#{defaultCommandView.btn1Submit}" ajax="false"/>
            <p:commandButton value="Button2" id="btn2" action="#{defaultCommandView.btn2Submit}" />
            <h:commandButton value="Button3" id="btn3" action="#{defaultCommandView.btn3Submit}" />

            <p:defaultCommand target="#{defaultCommandView.btn}" />
        </h:form>

    </ui:define>

</ui:composition>